import 'package:flutter/material.dart';
import 'package:flutter_vant/component/passwordInput.dart';
import 'package:flutter_vant/main.dart';
import 'package:simulator/components/DemoViewGroup/index.dart';

class PasswordInputView extends HookWidget {
  const PasswordInputView({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    renderBase() {
      return IDemoData(title: '基础用法', isCell: false, widgets: [
        VanPasswordInput(
          value: '1111',
          focused: true,
        )
      ]);
    }

    renderCustomLen() {
      return IDemoData(title: '自定义长度', isCell: false, widgets: [
        VanPasswordInput(
          length: 4,
          value: '123',
        )
      ]);
    }

    renderGutter() {
      return IDemoData(title: '格子间距', isCell: false, widgets: [
        VanPasswordInput(
          length: 6,
          gutter: 0,
          value: '123',
        )
      ]);
    }

    renderDisplay() {
      return IDemoData(title: '明文展示', isCell: false, widgets: [
        VanPasswordInput(
          length: 6,
          mask: false,
          value: '123',
        )
      ]);
    }

    renderTip() {
      return IDemoData(title: '提示信息', isCell: false, widgets: [
        VanPasswordInput(
          length: 6,
          info: '密码为6位数',
          value: '123',
        )
      ]);
    }

    return HookView(
        title: 'PasswordInput',
        child: DemoViewGroup(data: [
          // 基础用法
          renderBase(),
          // 自定义长度
          renderCustomLen(),
          // 格子间距
          renderGutter(),
          // 明文展示
          renderDisplay(),
          // 提示信息
          renderTip()
        ]));
  }
}
